package com.yyks.cnbooking.dubbo.controller;

import com.yeyks.common.ajax.AjaxResponseBody;
import com.yyks.cnbooking.dubbo.base.CNResponse;
import com.yyks.cnbooking.dubbo.feign.CnBookingFeignClient;
import com.yyks.cnbooking.dubbo.param.roomsearch.CbRoomSearchParam;
import com.yyks.cnbooking.dubbo.result.roomsearch.CbRoomSearchData;
import io.swagger.annotations.ApiOperation;
import lombok.RequiredArgsConstructor;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/booking")
@RequiredArgsConstructor(onConstructor = @__(@Autowired))
public class CnBookingController {

    private final CnBookingFeignClient cnBookingFeignClient;

    @ApiOperation("房间搜索测试")
    @PostMapping("/roomSearch")
    public AjaxResponseBody roomSearch(String countryId,
                                       String provinceId,
                                       String cityId,
                                       Integer pageSize,
                                       Integer pageNo){

        CbRoomSearchParam param = new CbRoomSearchParam();
        param.setCountryId(countryId);
        param.setProvinceId(provinceId);
        param.setCityId(cityId);
        param.setPageNo(pageNo);
        param.setPageSize(pageSize);
        CNResponse<CbRoomSearchData> cbRoomSearchDataCNResponse = cnBookingFeignClient.roomSearch(param);
        return AjaxResponseBody.success(cbRoomSearchDataCNResponse);
    }

}
